-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/precompile account codes #1580
Conversation
Try-runtime against centrifuge ./target/debug/centrifuge-chain try-runtime --runtime target/debug/wbuild/centrifuge-runtime/centrifuge_runtime.wasm --chain centrifuge on-runtime-upgrade live --uri wss://fullnode.centrifuge.io:443
2023-10-04 11:41:51 since no at is provided, setting it to latest finalized head, 0x4e3d3a7f4cd97b020abbf7d93a5c658d1e8d5ed3458cd904e3669406106b5675
2023-10-04 11:41:51 since no prefix is filtered, the data for all pallets will be downloaded
2023-10-04 11:41:51 scraping key-pairs from remote at block height 0x4e3d3a7f4cd97b020abbf7d93a5c658d1e8d5ed3458cd904e3669406106b5675
2023-10-04 11:42:05 Querying a total of 111639 keys from prefix , splitting among 10 threads, 11164 keys per thread
2023-10-04 11:42:52 adding data for hashed prefix: , took 60s
2023-10-04 11:42:52 adding data for hashed key: 3a636f6465
2023-10-04 11:42:52 adding data for hashed key: 26aa394eea5630e07c48ae0c9558cef7f9cce9c888469bb1a0dceaa129672ef8
2023-10-04 11:42:52 adding data for hashed key: 26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac
2023-10-04 11:42:52 👩👦 scraping child-tree data from 248 top keys, split among 10 threads, 25 top keys per thread
2023-10-04 11:42:54 initialized state externalities with storage root 0x41fcfded7b27b67587fd10f97894605908c508b3612d6081f2c290c060dccd9e and state_version V0
2023-10-04 11:42:55 original spec: RuntimeString::Owned("centrifuge")-1020, code hash: 64425703afde7027710529071fa37bada9ede719d71b5b0793dac2a29aa1589d
2023-10-04 11:42:56 new spec: RuntimeString::Owned("centrifuge")-1021, code hash: f3b1ea0f885b1365e45e97ccffc8a97eaa2e1c1a0a866debf8fb2589388e0ed1
2023-10-04 11:43:01 anemoy_pool::Migration: currency set to USDC ✓
2023-10-04 11:43:01 add_wrapped_usdc_variants::Migration: on_runtime_upgrade succeeded ✓
2023-10-04 11:43:01 💎 Inserting precompile account codes: on_runtime_upgrade: started
2023-10-04 11:43:01 💎 Inserting precompile account codes: on_runtime_upgrade: completed!
2023-10-04 11:43:01 ⚠️ ParachainSystem declares internal migrations (which *might* execute). On-chain `StorageVersion(2)` vs current storage version `StorageVersion(2)`
2023-10-04 11:43:01 ⚠️ XcmpQueue declares internal migrations (which *might* execute). On-chain `StorageVersion(3)` vs current storage version `StorageVersion(2)`
2023-10-04 11:43:01 ⚠️ PolkadotXcm declares internal migrations (which *might* execute). On-chain `StorageVersion(1)` vs current storage version `StorageVersion(1)`
2023-10-04 11:43:01 ⚠️ DmpQueue declares internal migrations (which *might* execute). On-chain `StorageVersion(2)` vs current storage version `StorageVersion(1)`
2023-10-04 11:43:01 ⚠️ Ethereum declares internal migrations (which *might* execute). On-chain `StorageVersion(0)` vs current storage version `StorageVersion(0)`
2023-10-04 11:43:01 TryRuntime_on_runtime_upgrade executed without errors. Consumed weight = (2200000000 ps, 0 byte), total weight = (500000000000 ps, 5242880 byte) (0.44 %, 0.00 %). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM! One small change request: We use the reads
weight instead of the writes
one for the migration.
Feel free to bump the Centrifuge Chain spec as well as part of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd love if we did not introduce testnet-runtime
to Centrifuge runtime and return the migration weight properly without unwrapping, see comment. But I don't want to block this.
runtime/centrifuge/src/migrations.rs
Outdated
{ crate::VERSION.spec_version }, | ||
1020, | ||
>, | ||
runtime_common::migrations::precompile_account_codes::Migration<crate::Runtime, 1020>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will exclude the migration from Catalyst as the last_version
is 1021 here. I'd rename WITH_VERSION
to MAX_VERSION
and set it to 1021 for Centrifuge runtime.
Try Runtime RunsCentrifuge./target/debug/centrifuge-chain try-runtime --runtime target/debug/wbuild/centrifuge-runtime/centrifuge_runtime.wasm --chain centrifuge on-runtime-upgrade live --uri wss://fullnode.centrifuge.io:443
2023-10-04 15:59:48 since no at is provided, setting it to latest finalized head, 0x5ac5e0d88eca7c1c0bef65065e62da73fa70ebf70b0b4a65dead00d4dd17d10c
2023-10-04 15:59:48 since no prefix is filtered, the data for all pallets will be downloaded
2023-10-04 15:59:48 scraping key-pairs from remote at block height 0x5ac5e0d88eca7c1c0bef65065e62da73fa70ebf70b0b4a65dead00d4dd17d10c
2023-10-04 16:00:00 Querying a total of 111630 keys from prefix , splitting among 10 threads, 11163 keys per thread
2023-10-04 16:00:49 adding data for hashed prefix: , took 60s
2023-10-04 16:00:49 adding data for hashed key: 3a636f6465
2023-10-04 16:00:49 adding data for hashed key: 26aa394eea5630e07c48ae0c9558cef7f9cce9c888469bb1a0dceaa129672ef8
2023-10-04 16:00:49 adding data for hashed key: 26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac
2023-10-04 16:00:49 👩👦 scraping child-tree data from 248 top keys, split among 10 threads, 25 top keys per thread
2023-10-04 16:00:51 initialized state externalities with storage root 0x5280432ae48790514796d7bf1c64aae931aeb0ef99588039236094f964e97d19 and state_version V0
2023-10-04 16:00:52 original spec: RuntimeString::Owned("centrifuge")-1020, code hash: 64425703afde7027710529071fa37bada9ede719d71b5b0793dac2a29aa1589d
2023-10-04 16:00:53 new spec: RuntimeString::Owned("centrifuge")-1022, code hash: 32bf8b96d0dc7f2a8c44fa76842630a4d20df90ea7bc943c0c8fa4c6b905b63d
2023-10-04 16:00:57 anemoy_pool::Migration: currency set to USDC ✓
2023-10-04 16:00:58 add_wrapped_usdc_variants::Migration: on_runtime_upgrade succeeded ✓
2023-10-04 16:00:58 precompile::AccountCodes: Inserting precompile account codes: on_runtime_upgrade: started
2023-10-04 16:00:58 precompile::AccountCodes: Inserting code for ECRECOVER.
2023-10-04 16:00:58 precompile::AccountCodes: Inserting code for SHA256.
2023-10-04 16:00:58 precompile::AccountCodes: Inserting code for RIPEMD160.
2023-10-04 16:00:58 precompile::AccountCodes: Inserting code for IDENTITY.
2023-10-04 16:00:58 precompile::AccountCodes: Inserting code for MODEXP.
2023-10-04 16:00:58 precompile::AccountCodes: Inserting code for BN128ADD.
2023-10-04 16:00:58 precompile::AccountCodes: Inserting code for BN128MUL.
2023-10-04 16:00:58 precompile::AccountCodes: Inserting code for BN128PAIRING.
2023-10-04 16:00:58 precompile::AccountCodes: Inserting code for BLAKE2F.
2023-10-04 16:00:58 precompile::AccountCodes: Inserting code for SHA3FIPS256.
2023-10-04 16:00:58 precompile::AccountCodes: Inserting code for DISPATCH.
2023-10-04 16:00:58 precompile::AccountCodes: Inserting code for ECRECOVERPUBLICKEY.
2023-10-04 16:00:58 precompile::AccountCodes: Inserting code for LP_AXELAR_GATEWAY.
2023-10-04 16:00:58 precompile::AccountCodes: Inserting precompile account codes, on_runtime_upgrade: completed!
2023-10-04 16:00:58 ⚠️ ParachainSystem declares internal migrations (which *might* execute). On-chain `StorageVersion(2)` vs current storage version `StorageVersion(2)`
2023-10-04 16:00:58 ⚠️ XcmpQueue declares internal migrations (which *might* execute). On-chain `StorageVersion(3)` vs current storage version `StorageVersion(2)`
2023-10-04 16:00:58 ⚠️ PolkadotXcm declares internal migrations (which *might* execute). On-chain `StorageVersion(1)` vs current storage version `StorageVersion(1)`
2023-10-04 16:00:58 ⚠️ DmpQueue declares internal migrations (which *might* execute). On-chain `StorageVersion(2)` vs current storage version `StorageVersion(1)`
2023-10-04 16:00:58 ⚠️ Ethereum declares internal migrations (which *might* execute). On-chain `StorageVersion(0)` vs current storage version `StorageVersion(0)`
2023-10-04 16:00:58 TryRuntime_on_runtime_upgrade executed without errors. Consumed weight = (3500000000 ps, 0 byte), total weight = (500000000000 ps, 5242880 byte) (0.70 %, 0.00 %). Catalyst./target/debug/centrifuge-chain try-runtime --runtime target/debug/wbuild/centrifuge-runtime/centrifuge_runtime.wasm --chain centrifuge on-runtime-upgrade live --uri wss://fullnode.catalyst.cntrfg.com:443
2023-10-04 15:56:53 since no at is provided, setting it to latest finalized head, 0x71993cf39040dd11503311c365907ed14ccfafc1d5464ee8ec69b62085a7dd8b
2023-10-04 15:56:53 since no prefix is filtered, the data for all pallets will be downloaded
2023-10-04 15:56:53 scraping key-pairs from remote at block height 0x71993cf39040dd11503311c365907ed14ccfafc1d5464ee8ec69b62085a7dd8b
2023-10-04 15:56:59 Querying a total of 58210 keys from prefix , splitting among 10 threads, 5821 keys per thread
2023-10-04 15:57:26 adding data for hashed prefix: , took 32s
2023-10-04 15:57:26 adding data for hashed key: 3a636f6465
2023-10-04 15:57:26 adding data for hashed key: 26aa394eea5630e07c48ae0c9558cef7f9cce9c888469bb1a0dceaa129672ef8
2023-10-04 15:57:26 adding data for hashed key: 26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac
2023-10-04 15:57:26 👩👦 scraping child-tree data from 3 top keys, split among 10 threads, 1 top keys per thread
2023-10-04 15:57:27 initialized state externalities with storage root 0x33c38e23adf5c93113550d28f3623e0f9d2f7ebb794a086ae6013826d96a8c8d and state_version V0
2023-10-04 15:57:28 original spec: RuntimeString::Owned("centrifuge")-1021, code hash: 14c2400b87a2dcd48780dff256bd6a5ddf942ba91832987e4f1836dcf86efc41
2023-10-04 15:57:28 new spec: RuntimeString::Owned("centrifuge")-1022, code hash: 32bf8b96d0dc7f2a8c44fa76842630a4d20df90ea7bc943c0c8fa4c6b905b63d
2023-10-04 15:57:33 anemoy_pool::Migration: NOT execution since current version higher than BEFORE_VERSION
2023-10-04 15:57:33 add_wrapped_usdc_variants::Migration: NOT execution since current version higher than BEFORE_VERSION
2023-10-04 15:57:33 precompile::AccountCodes: Inserting precompile account codes: on_runtime_upgrade: started
2023-10-04 15:57:33 precompile::AccountCodes: Inserting code for ECRECOVER.
2023-10-04 15:57:33 precompile::AccountCodes: Inserting code for SHA256.
2023-10-04 15:57:33 precompile::AccountCodes: Inserting code for RIPEMD160.
2023-10-04 15:57:33 precompile::AccountCodes: Inserting code for IDENTITY.
2023-10-04 15:57:33 precompile::AccountCodes: Inserting code for MODEXP.
2023-10-04 15:57:33 precompile::AccountCodes: Inserting code for BN128ADD.
2023-10-04 15:57:33 precompile::AccountCodes: Inserting code for BN128MUL.
2023-10-04 15:57:33 precompile::AccountCodes: Inserting code for BN128PAIRING.
2023-10-04 15:57:33 precompile::AccountCodes: Inserting code for BLAKE2F.
2023-10-04 15:57:33 precompile::AccountCodes: Inserting code for SHA3FIPS256.
2023-10-04 15:57:33 precompile::AccountCodes: Inserting code for DISPATCH.
2023-10-04 15:57:33 precompile::AccountCodes: Inserting code for ECRECOVERPUBLICKEY.
2023-10-04 15:57:33 precompile::AccountCodes: Inserting code for LP_AXELAR_GATEWAY.
2023-10-04 15:57:33 precompile::AccountCodes: Inserting precompile account codes, on_runtime_upgrade: completed!
2023-10-04 15:57:33 ⚠️ ParachainSystem declares internal migrations (which *might* execute). On-chain `StorageVersion(2)` vs current storage version `StorageVersion(2)`
2023-10-04 15:57:33 ⚠️ XcmpQueue declares internal migrations (which *might* execute). On-chain `StorageVersion(3)` vs current storage version `StorageVersion(2)`
2023-10-04 15:57:33 ⚠️ PolkadotXcm declares internal migrations (which *might* execute). On-chain `StorageVersion(1)` vs current storage version `StorageVersion(1)`
2023-10-04 15:57:33 ⚠️ DmpQueue declares internal migrations (which *might* execute). On-chain `StorageVersion(2)` vs current storage version `StorageVersion(1)`
2023-10-04 15:57:33 ⚠️ Ethereum declares internal migrations (which *might* execute). On-chain `StorageVersion(0)` vs current storage version `StorageVersion(0)`
2023-10-04 15:57:33 TryRuntime_on_runtime_upgrade executed without errors. Consumed weight = (1925000000 ps, 0 byte), total weight = (500000000000 ps, 5242880 byte) (0.39 %, 0.00 %). Altair./target/debug/centrifuge-chain try-runtime --runtime target/debug/wbuild/altair-runtime/altair_runtime.wasm --chain altair on-runtime-upgrade live --uri wss://fullnode.algol.cntrfg.io:443
2023-10-04 16:37:27 error: "`WsClientBuilder` failed to build: Transport(Failed to resolve IP addresses for this hostname: failed to lookup address information: nodename nor servname provided, or not known)"
Error: Input("failed to build ws client")
frederikgartenmeister@kf-FG centrifuge-chain % ./target/debug/centrifuge-chain try-runtime --runtime target/debug/wbuild/altair-runtime/altair_runtime.wasm --chain altair on-runtime-upgrade live --uri wss://fullnode.altair.centrifuge.io:443
2023-10-04 16:38:00 since no at is provided, setting it to latest finalized head, 0xbd63e79cbbb473b648bac0b22991f5c1cb86408d0be20aee0ee872a3f5e7c14f
2023-10-04 16:38:00 since no prefix is filtered, the data for all pallets will be downloaded
2023-10-04 16:38:00 scraping key-pairs from remote at block height 0xbd63e79cbbb473b648bac0b22991f5c1cb86408d0be20aee0ee872a3f5e7c14f
2023-10-04 16:38:07 Querying a total of 76570 keys from prefix , splitting among 10 threads, 7657 keys per thread
2023-10-04 16:38:42 adding data for hashed prefix: , took 41s
2023-10-04 16:38:42 adding data for hashed key: 3a636f6465
2023-10-04 16:38:42 adding data for hashed key: 26aa394eea5630e07c48ae0c9558cef7f9cce9c888469bb1a0dceaa129672ef8
2023-10-04 16:38:42 adding data for hashed key: 26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac
2023-10-04 16:38:42 👩👦 scraping child-tree data from 1 top keys, split among 10 threads, 1 top keys per thread
2023-10-04 16:38:42 initialized state externalities with storage root 0x7d5e610681e95efbcd0d41f5e71d1b3383c6cdf43e47fa4e54588f287eeee251 and state_version V0
2023-10-04 16:38:43 original spec: RuntimeString::Owned("altair")-1027, code hash: 34d2701c6472d4d3f525d7d8b8ed1538d55daf8e273b5b609f63957134036343
2023-10-04 16:38:44 new spec: RuntimeString::Owned("altair")-1034, code hash: 6a9d6bbb1b24d03e6ac02900ed61744baadab9dd19791329fcf03433dcc87693
2023-10-04 16:38:49 Nuke-Loans: nuking pallet...
2023-10-04 16:38:49 Nuke-Loans: storage cleared successful
2023-10-04 16:38:49 Nuke-Loans: iteration result. backend: 1 unique: 1 loops: 1
2023-10-04 16:38:49 Nuke-InterestAccrual: nuking pallet...
2023-10-04 16:38:49 Nuke-InterestAccrual: storage cleared successful
2023-10-04 16:38:49 Nuke-InterestAccrual: iteration result. backend: 3 unique: 3 loops: 3
2023-10-04 16:38:49 Nuke-PoolSystem: nuking pallet...
2023-10-04 16:38:49 Nuke-PoolSystem: storage cleared successful
2023-10-04 16:38:49 Nuke-PoolSystem: iteration result. backend: 4 unique: 4 loops: 4
2023-10-04 16:38:49 Nuke-Investments: nuking pallet...
2023-10-04 16:38:49 Nuke-Investments: storage cleared successful
2023-10-04 16:38:49 Nuke-Investments: iteration result. backend: 0 unique: 0 loops: 0
2023-10-04 16:38:49 💶 Rewards: Initiating ED funding to sovereign pallet account
2023-10-04 16:38:49 💎 AssetRegistryMultilocationToXCMV3: on_runtime_upgrade: started
2023-10-04 16:38:49 💎 AssetRegistryMultilocationToXCMV3: Found 5 LocationToAssetId keys
2023-10-04 16:38:49 💎 AssetRegistryMultilocationToXCMV3: Found 5 Metadata keys
2023-10-04 16:38:49 💎 AssetRegistryMultilocationToXCMV3: Cleared all LocationToAssetId entries successfully
2023-10-04 16:38:49 💎 AssetRegistryMultilocationToXCMV3: LocationToAssetId clearing iteration result. backend: 5 unique: 5 loops: 5
2023-10-04 16:38:49 Cleared all Metadata entries successfully
2023-10-04 16:38:49 💎 AssetRegistryMultilocationToXCMV3: Metadata clearing iteration result. backend: 5 unique: 5 loops: 5
2023-10-04 16:38:49 💎 AssetRegistryMultilocationToXCMV3: Starting migration of 4 assets
2023-10-04 16:38:49 💎 AssetRegistryMultilocationToXCMV3: on_runtime_upgrade: completed!
2023-10-04 16:38:49 ⚠️ DmpQueue declares internal migrations (which *might* execute). On-chain `StorageVersion(1)` vs current storage version `StorageVersion(1)`
2023-10-04 16:38:49 ⚠️ XcmpQueue declares internal migrations (which *might* execute). On-chain `StorageVersion(2)` vs current storage version `StorageVersion(2)`
2023-10-04 16:38:49 Migrated VersionNotifyTarget (13, 0, 2) to (13, <wasm:stripped>, 2)
2023-10-04 16:38:49 v1 applied successfully
2023-10-04 16:38:49 precompile::AccountCodes: Inserting precompile account codes: on_runtime_upgrade: started
2023-10-04 16:38:49 precompile::AccountCodes: Inserting code for ECRECOVER.
2023-10-04 16:38:49 precompile::AccountCodes: Inserting code for SHA256.
2023-10-04 16:38:49 precompile::AccountCodes: Inserting code for RIPEMD160.
2023-10-04 16:38:49 precompile::AccountCodes: Inserting code for IDENTITY.
2023-10-04 16:38:49 precompile::AccountCodes: Inserting code for MODEXP.
2023-10-04 16:38:49 precompile::AccountCodes: Inserting code for BN128ADD.
2023-10-04 16:38:49 precompile::AccountCodes: Inserting code for BN128MUL.
2023-10-04 16:38:49 precompile::AccountCodes: Inserting code for BN128PAIRING.
2023-10-04 16:38:49 precompile::AccountCodes: Inserting code for BLAKE2F.
2023-10-04 16:38:49 precompile::AccountCodes: Inserting code for SHA3FIPS256.
2023-10-04 16:38:49 precompile::AccountCodes: Inserting code for DISPATCH.
2023-10-04 16:38:49 precompile::AccountCodes: Inserting code for ECRECOVERPUBLICKEY.
2023-10-04 16:38:49 precompile::AccountCodes: Inserting code for LP_AXELAR_GATEWAY.
2023-10-04 16:38:49 precompile::AccountCodes: Inserting precompile account codes, on_runtime_upgrade: completed!
2023-10-04 16:38:49 ⚠️ ParachainSystem declares internal migrations (which *might* execute). On-chain `StorageVersion(2)` vs current storage version `StorageVersion(2)`
2023-10-04 16:38:49 ⚠️ XcmpQueue declares internal migrations (which *might* execute). On-chain `StorageVersion(3)` vs current storage version `StorageVersion(2)`
2023-10-04 16:38:49 ⚠️ PolkadotXcm declares internal migrations (which *might* execute). On-chain `StorageVersion(1)` vs current storage version `StorageVersion(1)`
2023-10-04 16:38:49 ⚠️ DmpQueue declares internal migrations (which *might* execute). On-chain `StorageVersion(2)` vs current storage version `StorageVersion(1)`
2023-10-04 16:38:49 ⚠️ Ethereum declares internal migrations (which *might* execute). On-chain `StorageVersion(0)` vs current storage version `StorageVersion(0)`
2023-10-04 16:38:49 TryRuntime_on_runtime_upgrade executed without errors. Consumed weight = (6400000000 ps, 0 byte), total weight = (500000000000 ps, 5242880 byte) (1.28 %, 0.00 %). AlgolNOTE: Currently down, so not able. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Also thanks for cleaning up stuff along the way :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your effort with all try-runtime
checks, works like a charm!
Description
pallet_evm::AccountCodes
storage for ALL precompiles.The problem is the following. During making a call to another contract the asm code contains a
EXTCODESIZE
instruction. This fetches the given code for an address. Precompiles have no code and hence we get aRevert
. Moonbeam has also solved it by setting theAccountCodes
storage for all precompiles.They set it to
0x600600fd
which I think are instructions to push two zero bytes into the stack and then revert.Changes and Descriptions
0x600600fd
to all precompileAccountCodes
storageAltair
,Centrifuge
,Development
Checklist: